package com.jml.策略模式.comparable和comparator;

public class Dog implements Comparable<Dog> {
    int weight, height;

    public Dog(int weight, int height) {
        this.weight = weight;
        this.height = height;
    }


    @Override
    public int compareTo(Dog c) {
        if (this.weight < c.weight) {
            //表示当前对象更小
            return -1;
        } else if (this.weight > c.weight) {
            //表示当前对象更大
            return 1;
        } else {
            //一样大
            return 0;
        }
    }

}
